#pragma once


#include <iostream>
#include <fstream>
#include "CG_ff_grid.h"
#include "CG_str_hash.h"


const int MAX_LINE_INPUT_LENGTH = 256;
const int MIN_LINE_INPUT_LENGTH = 3;
const int MAX_FF_NAME_LENGTH =    200;
const int MAX_COORD_LENGTH =      20;


typedef enum
{
	PARSE_SUCCESS             = 1,
	PARSE_FAIL_LOCATION_FILE  = 2,
	PARSE_FAIL_VECTORS_FILE   = 3,
	PARSE_FAIL_NAMES_FILE     = 4
}PARSE_RESULT;


class CG_parser
{
	private:
		ifstream location_file;
		ifstream vectors_file;
		ifstream names_file;
		long num_objects;
		PARSE_RESULT parse_location_file(CG_str_hash& ff_hash);
		PARSE_RESULT parse_activity_files(CG_str_hash& ff_hash, CG_ff_grid& ff_grid);
	public:
		CG_parser(char *lf_name, char *vf_name, char *nf_name);
		~CG_parser(void);
		PARSE_RESULT parse_data(CG_str_hash& ff_hash, CG_ff_grid& ff_grid);
};
